package day2.set;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

public class demo1_HashSet {
    public static void main(String[] args) {
        HashSet hs = new HashSet();
        hs.add("one");
        hs.add("two");
        hs.add("one");
        hs.add("three");
        hs.add("foure");
        hs.add("abc");
//        for (Object h : hs) {
//            System.out.println(h);
//            hs.remove("three");
//        }

        System.out.println("=============");
        Iterator it = hs.iterator();
        while (it.hasNext()) {
            Object o = it.next();
            System.out.println(o);
//            hs.remove("three");
            if(o.equals("three")){
                it.remove();
            }
        }
        System.out.println(hs.size());
    }
}
